package model

import (
	"choujiang/common/db"
	"fmt"
)

type Company struct {
	Id        int64  `xorm:"INT(11) not null pk autoincr"`
	Name      string `xorm:"VARCHAR(20) not null unique"`
	Phone     string `xorm:"VARCHAR(20) not null unique"`
	Address   string `xorm:"VARCHAR(255) not null default ''"`
	Contact   string `xorm:"VARCHAR(20) not null default ''"`
	Email     string `xorm:"VARCHAR(50) not null default ''"`
	CreatedAt int64  `xorm:"not null default 0 INT(11) created"`
	UpdatedAt int64  `xorm:"not null default 0 INT(11) updated"`
}

func GetCompanyInfo() *Company {
	company := new(Company)
	has, err := db.MysqlEngine.Get(company)
	fmt.Printf("GetUserByMiniUnionId err %+v\n", err)
	if !has || err != nil {
		return nil
	}
	return company
}
